from pyeasyaccept.commom.Configuration import Configuration
from pyeasyaccept.PythonEasyAcceptFacade import PythonEasyAcceptFacade
from pythoneasyaccept_test.TestFacade import TestFacade
import unittest

"""
This class tests the PythonEasyAcceptFacade with repeated tests.
@author: Danilo Torres
"""
class PythonEasyAcceptFacadeTest4(unittest.TestCase):

    def setUp(self):
        self.FILE_SEPARATOR = Configuration.FILE_SEPARATOR  
        self.testFacade = TestFacade()
        self.configuration = Configuration()        
        self.root = self.configuration.getProjectRoot()
            
    def tearDown(self):
        pass
    
    """
    This test method tests the PythonEasyAccept with repeated tests.
    """
    def testRepeatedTests(self):
        
        scriptFile1 = self.root + self.configuration.TEST_SCRIPTS_LOCATION + self.FILE_SEPARATOR +"script01.txt"
        scriptFile2 = self.root + self.configuration.TEST_SCRIPTS_LOCATION + self.FILE_SEPARATOR + "script02.txt"

        scripts = [scriptFile1, scriptFile1]
        numScripts1 = len(scripts)
        scripts.append(scriptFile2)
        facade = PythonEasyAcceptFacade(self.testFacade, scripts);
        facade.executeTests()
        self.assertEquals(4*numScripts1+1 , facade.getTotalNumberOfTests())
        self.assertEquals(2*numScripts1+0, facade.getTotalNumberOfNotPassedTests())
        self.assertEquals(2*numScripts1+1, facade.getTotalNumberOfPassedTests())
                
if __name__ == '__main__':
    unittest.main()